﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace theguineasyndrome
{
    abstract public class CharacterModel
    {
        public const float MAX_SPEED = 25;

        protected ContentManager content;

        protected Character character;

        protected Texture2D sprite;
        protected Animation animation;
        protected Vector2 size;
        protected float weight;
        protected float speed;
        protected float jumpForce;
        protected float deceleration;
        protected float maxSpeedX;

        protected Weapon weapon;

        abstract public Vector2 getShoulderPosition();
        abstract public Vector2 getFireSource();

        public CharacterModel(ContentManager content, Weapon weapon)
        {
            this.content = content;
            this.weapon = weapon;
        }

        protected void calculateMaxSpeed()
        {
            maxSpeedX = (float)Math.Sqrt(MAX_SPEED * MAX_SPEED - jumpForce * jumpForce);
        }

        public float Width
        {
            get { return size.X; }
        }

        public float Height
        {
            get { return size.Y; }
        }

        public Character Character
        {
            set { character = value; }
        }

        public float getWeight()
        {
            return weight;
        }

        public float getSpeed()
        {
            return speed;
        }

        public float getJumpForce()
        {
            return jumpForce;
        }

        public float getDeceleration()
        {
            return deceleration;
        }

        public float getMaxSpeedX()
        {
            return maxSpeedX;
        }

        public Animation Animation
        {
            get { return animation; }
        }

        public Weapon Weapon
        {
            get { return weapon; }
        }

        public virtual void Update(GameTime gameTime)
        {
            animation.Update(gameTime);
        }

        public virtual void Draw(SpriteBatch spriteBatch, Camera camera)
        {
            animation.Draw(spriteBatch, camera);
        }
    }
}
